package com.danicsoft.daide.command;

import com.danicsoft.daide.token.TokenGroup;
import com.danicsoft.daide.token.TokenMap.Commands;

/**
 * Implements the NOT command. This command can be added in front of some
 * commands to cancel them. It can be added in front of TME, GOF, SUB, CCD, DRW
 * or any press offer to cancel it.
 * 
 * @author Daniel Yule (daniel.yule@gmail.com)
 * @version 1.0
 */
public class NotCommand extends ReducibleCommand {

	/**
	 * Create a new NotCommand from the given command.
	 * 
	 * @param command
	 *        The command we are negating.
	 */
	public NotCommand(Command command) {
		this.command = command;
	}

	/**
	 * Construct a new <code>NotCommand</code> from the tokens given.
	 * 
	 * @param tokens
	 *        The tokens to create this NotCommand from. They should consist of
	 *        a TokenGroup that contains another command.
	 * @throws ParseException
	 *         If the command could not be parsed.
	 */
	public NotCommand(TokenGroup tokens) throws ParseException {
		super(tokens);
	}

	@Override
	public String toString() {
		return "Negated: " + command.toString();
	}

	@Override
	public byte getType() {
		return Commands.NOT;
	}

}
